/*
    Forms

    For anything that isn't the search form
    (Newsletter signup, etc)
*/

$form-border-color: #e6e6e6;
$form-text-color: $dark;

.frm {
    display: block;
}
    .frm__label {
        font-size: 0.9em;
        font-weight: 600;
        color: $form-text-color;
    }
        // checkboxes
        .frm__label__chk {
            margin-top: 0.4em;
            margin-right: $half-unit;
            display: inline-block;
            vertical-align: top;
        }
        .frm__label__txt {
            display: inline-block;
            overflow: hidden;
        }

    .frm__text,
    .frm__input {
        @include box-sizing('border-box');
        margin: 0;
        font-size: 1em;
        background-color: $alt-bg;
        border: 1px solid $form-border-color;
        color: $form-text-color;
        outline: none;
    }
        .frm__input--disabled {
            background-color: $form-border-color;
        }

    .frm__input {
        border-radius: $default-border-radius;
        height: 2em;
        line-height: 2em;
        padding-left: $small-unit;
        // on mobile devices the top/bottom padding are different:
        padding-top: 0;
        padding-bottom: 0;
        // disable inner shadows on webkit mobile devices:
        -webkit-appearance: none;
    }
        .frm__input--clearable {
            position: relative;

            .frm__input {
                padding-right: 2em;
            }
            .frm__input__clear {
                position: absolute;
                top: 0;
                right: 0;
                font-size: .8em;
                line-height: 2.6em;
                padding: 0 $base-unit;
                color: $light;
                cursor: pointer;
                &:hover {
                    color: $form-text-color;
                }
            }
        }
            .frm__input__clear {
                @extend %ddgsi !optional;
            }
    .frm__text {
        padding: $small-unit;
        border-radius: $default-border-radius;
    }

    .frm__select {
        @include box-sizing('border-box');
        border-radius: $default-border-radius;
        display: inline-block;
        position: relative;
        overflow: hidden;

        line-height: 2.2;
        height: 2.35em;

        border: 1px solid $button-border;
        background-color: $button-bg;
        color: $button-color;

        padding: 0;
        vertical-align: middle;
        margin-bottom: 0;
        cursor: pointer;

        &:hover {
            background-color: $white;
        }

        select {
            @include experimental(appearance, none);
            background: none;
            cursor: pointer;

            margin: 0;
            padding: 0 28px 0 $three-quarter-unit;
            position: relative;
            display: block;

            font-size: 1em;
            line-height: inherit;

            // yucky hacks to override browser junk
            min-width: 10em;
            width: 140% !important;
            height: 2.2em !important;
            outline: none !important;
            border: none !important;

            .lt-ie9 & {
                padding-bottom: 0.4em;
            }
        }

        &:after {
            @include icon('down');

            margin-top: -5px;
            font-size: 12px;
            line-height: 1;

            pointer-events: none;
            vertical-align: middle;
            display: inline-block;

            position: absolute;
            right: 10px;
            top: 50%;
        }
    }

    .frm__select--no-first {
        // on FF and Chrome this hides the first selection
        select option:first-child {
            display: none;
        }
    }

    .frm__buttons {
        clear: both;
        padding-top: $base-unit;
        .frm__btn {
            margin-left: $half-unit;
        }
    }
        .frm__btn {
            min-width: 7em;
            height: 2em; // explicit height required for input elements e.g. input[type="submit"]
        }
    .frm__switch {
        position: relative;
    }
        .frm__switch__inp {
            border: 0;
            clip: rect(0 0 0 0);
            height: 1px;
            margin: -1px;
            overflow: hidden;
            padding: 0;
            position: absolute;
            width: 1px;
        }
        .is-checked .frm__switch__label {
            @extend %btn--primary;
        }
        .frm__switch-on {
            display: none;
            .is-checked  & {
                display:block;
            }
        }
        .frm__switch-off {
            display: block;
            .is-checked & {
                display: none;
            }
        }
    .frm__color__swatch {
        @include box-sizing('border-box');
        border-radius: $default-border-radius;
        cursor: pointer;
        display: block;
        width: 50px; // matches the on/off switch width, helps the forms look better aligned
        height: 2em;
        border: 1px solid #e6e6e6;
    }
    .frm__hr {
        width: 100%;
        margin: $base-unit 0;
        border-bottom: 1px solid #eaeaea;
    }
.frm--newsletter {
    .frm__input {
        border-radius: $default-border-radius;
        vertical-align: top;
        width: 60%;
        max-width: 24em;
        height: 2.5em;
        line-height: 2;
        font-weight: 600;
    }
    .frm__btn {
        @include box-sizing('border-box');
        vertical-align: top;
        height: 2.5em;
    }
}
    .frm--newsletter__chks {
        text-align: center;
        margin: $big-unit auto 0;
        font-size: 1em;
        min-width: 20em;
        width: 70%;
        .frm__label {
            display: inline-block;
            margin: 0 $big-unit;
            text-align: left;
            min-width: 8em;
        }
    }
    .frm--newsletter__frq {
        color: $light;
        display: block;
        font-size: 0.9em;
        font-weight: normal;
    }


// vertical form
.frm--vrt {
    .frm__label,
    .frm__input,
    .frm__text {
        display: block;
        width: 100%;
    }

    .frm__label {
        margin-top: $big-unit;
        margin-bottom: $half-unit;
    }
}
